<template>
  <el-aside :width="sideWidth + 'px'"
            style="background-color: rgb(238, 241, 246);box-shadow: 2px 0 6px rgba(0,21,41,.35);">
    <el-menu :default-openeds="['1', '3']" style="height: 100%;overflow-x: hidden"
             background-color="rgb(48,65,86)" text-color="#FFF" active-text-color="#FFd04b"
             :collapse-transition="false" :collapse="isCollapse" router
    >
      <div style="height: 60px;line-height: 60px;text-align: center">
        <img src="../assets/logo.png" alt="" style="width: 15px;position: relative;top: 5px;margin-right: 5px">
        <b style="color: #FFF" v-show="logoTextShow">人力资源管理系统</b>
      </div>
      <el-menu-item index="/">
        <template slot="title">
          <i class="el-icon-house"></i>
          <span slot="title">主页</span>
        </template>
      </el-menu-item>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span slot="title">系统管理</span>
        </template>
        <el-menu-item index="user">
          <i class="el-icon-user-solid"></i>
          <span slot="title">用户管理</span>
        </el-menu-item>
        <el-menu-item index="2-2">选项2</el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>
</template>

<script>
import {EventBus, EventNames} from "@/utils/EventBus";

export default {
  name: "Aside",
  data() {
    return {
      isCollapse: false,
      sideWidth: 200,
      logoTextShow: true,
    }
  },
  created() {
    EventBus.$on(EventNames.MESSAGE_ONE, (message) => {
      this.sideWidth = message;
    })
    EventBus.$on(EventNames.MESSAGE_TWO, (message) => {
      this.isCollapse = !message;
      this.logoTextShow = message;
    })
  }
}
</script>

<style scoped>

</style>